ostree-fetcher: make _ostree_fetcher_stream_uri_sync private
authorGiuseppe Scrivano <gscrivan@redhat.com>
Wed, 5 Nov 2014 08:48:12 +0000 (09:48 +0100)
committerColin Walters <walters@verbum.org>
Thu, 13 Nov 2014 02:20:28 +0000 (21:20 -0500)
Rename _ostree_fetcher_contents_membuf_sync to
ostree_fetcher_request_uri_to_membuf and drop unused argument
user_data.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
src/libostree/ostree-fetcher.c
src/libostree/ostree-fetcher.h
src/libostree/ostree-metalink.c
src/libostree/ostree-repo-pull.c

index 8567006a4d4a890e1b334153c9343c1c1ca10bb9..429f10697071ca2295f9626c5b58eb4171bc13e1 100644 (file)
@@ -692,18 +692,9 @@ typedef struct
   GInputStream   *result_stream;
   GMainLoop      *loop;
   GError         **error;
-  gpointer       user_data;
 }
 FetchUriSyncData;
 
-static gboolean
-run_mainloop_monitor_fetcher (FetchUriSyncData *data)
-{
-  g_main_loop_run (data->loop);
-
-  return TRUE;
-}
-
 static void
 fetch_uri_sync_on_complete (GObject        *object,
                             GAsyncResult   *result,
@@ -717,16 +708,15 @@ fetch_uri_sync_on_complete (GObject        *object,
 }
 
 gboolean
-_ostree_fetcher_contents_membuf_sync (OstreeFetcher  *fetcher,
-                                      SoupURI        *uri,
-                                      gboolean        add_nul,
-                                      gboolean        allow_noent,
-                                      GBytes         **out_contents,
-                                      GMainLoop      *loop,
-                                      gpointer       user_data,
-                                      guint64        max_size,
-                                      GCancellable   *cancellable,
-                                      GError         **error)
+_ostree_fetcher_request_uri_to_membuf (OstreeFetcher  *fetcher,
+                                       SoupURI        *uri,
+                                       gboolean        add_nul,
+                                       gboolean        allow_noent,
+                                       GBytes         **out_contents,
+                                       GMainLoop      *loop,
+                                       guint64        max_size,
+                                       GCancellable   *cancellable,
+                                       GError         **error)
 {
   gboolean ret = FALSE;
   const guint8 nulchar = 0;
@@ -740,7 +730,6 @@ _ostree_fetcher_contents_membuf_sync (OstreeFetcher  *fetcher,
   if (g_cancellable_set_error_if_cancelled (cancellable, error))
     return FALSE;
 
-  data.user_data = user_data;
   data.loop = loop;
   data.error = error;
 
@@ -749,7 +738,7 @@ _ostree_fetcher_contents_membuf_sync (OstreeFetcher  *fetcher,
                                    cancellable,
                                    fetch_uri_sync_on_complete, &data);
 
-  run_mainloop_monitor_fetcher (&data);
+  g_main_loop_run (loop);
   if (!data.result_stream)
     {
       if (allow_noent)
index 2d3f6c0edaf88ff4ae1efb428d6ba8497d3b5649..1a6c95b7593954290c341d709df8ac59a0c665a8 100644 (file)
@@ -76,16 +76,15 @@ GFile *_ostree_fetcher_request_uri_with_partial_finish (OstreeFetcher *self,
                                                        GAsyncResult  *result,
                                                        GError       **error);
 
-gboolean _ostree_fetcher_contents_membuf_sync (OstreeFetcher *fetcher,
-                                               SoupURI        *uri,
-                                               gboolean       add_nul,
-                                               gboolean       allow_noent,
-                                               GBytes         **out_contents,
-                                               GMainLoop      *loop,
-                                               gpointer       user_data,
-                                               guint64        max_size,
-                                               GCancellable   *cancellable,
-                                               GError         **error);
+gboolean _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
+                                                SoupURI        *uri,
+                                                gboolean       add_nul,
+                                                gboolean       allow_noent,
+                                                GBytes         **out_contents,
+                                                GMainLoop      *loop,
+                                                guint64        max_size,
+                                                GCancellable   *cancellable,
+                                                GError         **error);
 G_END_DECLS
 
 #endif
index 7e37c8c9bfabc8fa33007fbfb9402ad43ef3af18..5244e917ae96c96ab2782dd6caa3f508c674414b 100644 (file)
@@ -691,16 +691,15 @@ _ostree_metalink_request_sync (OstreeMetalink        *self,
 
   g_task_set_task_data (task, request, ostree_metalink_request_unref);
 
-  if (! _ostree_fetcher_contents_membuf_sync (self->fetcher,
-                                              self->uri,
-                                              FALSE,
-                                              FALSE,
-                                              &out_contents,
-                                              loop,
-                                              NULL,
-                                              self->max_size,
-                                              cancellable,
-                                              error))
+  if (! _ostree_fetcher_request_uri_to_membuf (self->fetcher,
+                                               self->uri,
+                                               FALSE,
+                                               FALSE,
+                                               &out_contents,
+                                               loop,
+                                               self->max_size,
+                                               cancellable,
+                                               error))
     goto out;
 
   if (! on_metalink_bytes_read (request, request, &data, out_contents, error))
index ad752ff197311b40b7f4bc412d1729950c6ef181..7b191785195058d22ae99b374799e5d40243db65 100644 (file)
@@ -258,16 +258,15 @@ fetch_uri_contents_membuf_sync (OtPullData    *pull_data,
 {
   gboolean ret;
   pull_data->fetching_sync_uri = uri;
-  ret = _ostree_fetcher_contents_membuf_sync (pull_data->fetcher,
-                                              uri,
-                                              add_nul,
-                                              allow_noent,
-                                              out_contents,
-                                              pull_data->loop,
-                                              pull_data,
-                                              OSTREE_MAX_METADATA_SIZE,
-                                              cancellable,
-                                              error);
+  ret = _ostree_fetcher_request_uri_to_membuf (pull_data->fetcher,
+                                               uri,
+                                               add_nul,
+                                               allow_noent,
+                                               out_contents,
+                                               pull_data->loop,
+                                               OSTREE_MAX_METADATA_SIZE,
+                                               cancellable,
+                                               error);
   pull_data->fetching_sync_uri = NULL;
   return ret;
 }